include('shared.lua')

ENT.RenderGroup 		= RENDERGROUP_OPAQUE

function ENT.Initialize()
	killicon.AddFont("bigbomb","CSKillIcons","I",Color(100,100,100,255))
	killicon.AddFont("env_physexplosion","CSKillIcons","I",Color(100,100,100,255))
	killicon.AddFont("bigbomb_fragment","CSKillIcons","I",Color(100,100,100,255))
	util.PrecacheSound("weapons/c4/c4_beep1.wav")
	util.PrecacheSound("weapons/c4/c4_disarm.wav")
	util.PrecacheSound("weapons/c4/c4_explode1.wav")
	util.PrecacheSound("weapons/c4/c4_exp_deb1.wav")
end

function ENT:HUDPaint(tr)
	if LocalPlayer():GetPos():Distance(self:GetPos()) < 2048 && self.dt.Armed then
		local pos = self:GetPos()+self:GetAngles():Up()*30
		
		pos.z = pos.z + 14
		pos = pos:ToScreen()
		local time = math.ceil(self.dt.Time-CurTime())
		if time <= 2 then
			time = "YOU JUST LOST\nTHE GAME"
		end
		draw.DrawText("BOMB\n" .. tostring(time), "TargetID", pos.x + 1, pos.y + 1, Color(0, 0, 0, 255), 1)
		draw.DrawText("BOMB\n" .. tostring(time), "TargetID", pos.x, pos.y, Color(255,0,0,255), 1)
	end
end